package com.motu.monstercity.server.game.logic;

import com.motu.monstercity.module.common.network.ResponseUtils;
import com.motu.monstercity.module.common.servermanager.ServerInfo;
import com.motu.monstercity.module.common.servermanager.ServerManager;
import com.motu.monstercity.protocol.*;
import com.motu.monstercity.server.game.base.AllParam;
import com.motu.monstercity.server.game.base.CommonUtils;
import com.motu.monstercity.server.game.base.LockKey;
import com.motu.monstercity.server.game.base.ProtoDataUtils;
import com.motu.monstercity.server.game.commondata.mail.MailConstant;
import com.motu.monstercity.server.game.commondata.maintask.MainTaskConstant;
import com.motu.monstercity.server.game.commondata.rank.RankConstant;
import com.motu.monstercity.server.game.commondata.rank.RankReward;
import com.motu.monstercity.server.game.commondata.skill.SkillConstant;
import com.motu.monstercity.server.game.commondata.system.SystemConstant;
import com.motu.monstercity.server.game.commondata.world.WorldConstant;
import com.motu.monstercity.server.game.commondata.worldboss.WorldBoss;
import com.motu.monstercity.server.game.log.LogType;
import com.motu.monstercity.server.game.timedtask.TimeTaskCmd;
import com.motu.monstercity.server.game.timedtask.TimedTaskManager;
import com.motu.monstercity.server.game.userdata.*;
import com.motu.monstercity.server.game.verticle.MainVerticle;
import com.motu.vertx.module.utility.main.MainService;
import com.motu.vertx.module.utility.redis.RedisTools;
import com.motu.vertx.module.utility.toolset.ErrorWord;
import com.motu.vertx.module.utility.toolset.TimeUtils;
import com.motu.vertx.module.utility.toolset.Tool;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.core.shareddata.Lock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;

public class WorldBossManager extends WorldBossUserData {
    private static Logger logger = LoggerFactory.getLogger(WorldBossManager.class);
    private static int TRY_AUTO_BATTLE = 5;  // 容错检测定时任务未完成的行军任务


    // 更新世界Boss的排行榜
    public static void updateWorldBossRank(UserInfo userInfo, long score) {
        long userId = userInfo.getId();
        int serverId = userInfo.getServerId();
        if (!isBattleStep(TimeUtils.getCurTime())) {
            return;
        }  // 如果不是进行期返回
        String dateKey = RankManager.getDateKey(RankConstant.SERVER_RANK_WORLD_BOSS);//今日的0点0分0秒
        RankManager.updateRank(RankConstant.SERVER_RANK_WORLD_BOSS, serverId, userId, score, dateKey);//  时间key
        UserWorldBossInfo userWorldBossInfo = getUserWorldBossInfo(userId);
        UserUnion userUnion = UnionManager.getUserUnion(userId);
        // 没有退过盟且有盟
        if (userWorldBossInfo.getIsQuit() == 0 && userUnion.getUnionId() > 0) {
            if (userWorldBossInfo.getUnionId() == 0) { // 还没有绑定联盟，先绑定上
                userWorldBossInfo.putUnionId(userUnion.getUnionId());
                userWorldBossInfo.update();
            }
            updateWorldBossUnionRank(serverId, userUnion.getUnionId(), score); // 更新联盟累计伤害
        }
        // 如果分数刷新了历史最高的排名
        String dateKey2 = RankManager.getDateKey(RankConstant.SERVER_UNION_RANK_WORLD_BOSS);//今日的0点0分0秒
        int myRank = RankManager.getMyRank(RankConstant.SERVER_RANK_WORLD_BOSS, serverId, userId, dateKey2);
        if (myRank == 1) {
            //  本服通告！[玩家名称] 凭借卓越的输出，成为对世界 BOSS 造成伤害的第 1 名，让我们为他欢呼！
            BoardcastManager.publicWorldBossTopAllUser(userInfo);
        }
    }

    // 更新世界Boss的联盟总伤害排行榜
    public static void updateWorldBossUnionRank(int serverId, long unionId, long score) {
        String dateKey2 = RankManager.getDateKey(RankConstant.SERVER_UNION_RANK_WORLD_BOSS);//今日的0点0分0秒
        RankManager.updateRank(RankConstant.SERVER_UNION_RANK_WORLD_BOSS, serverId, unionId, score, dateKey2);
    }


    // 加盟
    public static void joinUnion(long userId) {
        if (!isBattleStep(TimeUtils.getCurTime())) {
            return;
        }
        // 判断是否在世界Boss开始时间
        UserWorldBossInfo userWorldBossInfo = getUserWorldBossInfo(userId);
        if (userWorldBossInfo.getIsQuit() == 1) {  // 退过盟的不用处理
            return;
        }
        userWorldBossInfo.putIsQuit(1);
        userWorldBossInfo.update();
    }

    // 退盟
    public static void quitUnion(long userId) {
        if (!isBattleStep(TimeUtils.getCurTime())) {
            return;
        }
        // 判断是否在世界Boss开始时间
        UserWorldBossInfo userWorldBossInfo = getUserWorldBossInfo(userId);
        if (userWorldBossInfo.getIsQuit() == 1) {  // 退过盟的不用处理
            return;
        }
        userWorldBossInfo.putIsQuit(1);
        userWorldBossInfo.update();
    }

    // 解锁大世界行军的世界Boss事件
    public static UserWorldEventLocation unlockWorldBossEvent(UserInfo userInfo) {
        tryAutoArrive(userInfo.getServerId(),userInfo.getId());  // 尝试自动战斗
        return initWorldBossEventLocation(userInfo);
    }

    // 初始化世界Boss事件信息
    public static UserWorldEventLocation initWorldBossEventLocation(UserInfo userInfo) {
        long userId = userInfo.getId();
        WorldBoss worldBossConfig = getWorldBossConfig(userInfo.getServerId());
        if (worldBossConfig == null) {
            return null;
        }
        UserWorldEventLocation userWorldEventLocation = WorldManager.getUserWorldEventLocation(userId,  WorldConstant.WORLD_EVENT_LOCATION_ID_BOSS);
        if (userWorldEventLocation == null){
            userWorldEventLocation = new UserWorldEventLocation(userId, WorldConstant.WORLD_EVENT_LOCATION_ID_BOSS, WorldConstant.WORLD_EVENT_LOCATION_TYPE_7);
            userWorldEventLocation.putEventId(worldBossConfig.getPeriods());
            userWorldEventLocation.putOnewayTime(AllParam.WORLD_BOSS_MARCHING_TIME);
            userWorldEventLocation.doCreate();
        }else{
            // 如果boss事件不一样则改变值
            if (userWorldEventLocation.getEventId()  != worldBossConfig.getPeriods()){
                userWorldEventLocation.putEventId(worldBossConfig.getPeriods());
                userWorldEventLocation.update();
            }
        }
        return userWorldEventLocation;
    }


    // 获取当前期数 //  获取world_boss表的boss_reward字段   按照系统解锁天数
    public static WorldBoss getWorldBossConfig(int serverId) {
        int unlockDay = AllParam.WORLD_BOSS_OPEN_DAY;
        // 获取开服时间和配置的时间差的几天
        int serverOpenDay = ServerManager.getServerOpenDay(serverId);
        return getWorldBossByDay(serverOpenDay, unlockDay);
    }



    // 出发世界Boss
    public static ErrorWord gotoWorldBoss(UserInfo userInfo, long userId, int teamId, int soldier, List<Integer> partnerIds, CsGameWorld.CSGameWorldEventGotoResponse.Builder response, UserWorldEventLocation userWorldEventLocation, int locationId, long curTime, int coordX, int coordY) {
        // 是否开启了
        boolean canGoto = WorldBossManager.canGoToWorldBoss(curTime);
        if (!canGoto){
            return ErrorWord.INVALID_OPERATION;
        }
        boolean open = WorldBossManager.isOpen(userInfo.getServerId());
        if (!open){
            return ErrorWord.INVALID_OPERATION;
        }
        WorldBoss bossConfig = WorldBossManager.getWorldBossConfig(userInfo.getServerId());
        if (bossConfig == null) {
            return ErrorWord.NOT_DATA;
        }
        UserWorldTeam userWorldTeam = WorldManager.getUserWorldTeam(userId, teamId);
        if (userWorldTeam == null || userWorldTeam.getStatus() != WorldConstant.WORLD_TEAM_STATUS_0) {
            return ErrorWord.WRONG_STATUS;
        }
        UserWorldInfo userWorldInfo = WorldManager.getUserWorldInfo(userId);
        if (userWorldInfo.getEnergy() < bossConfig.getEventEnergy()) {
            return ErrorWord.ITEM_LACK;
        }

        UserCityInfo userCityInfo = BuildManager.getUserCityInfo(userId);
        if (soldier < bossConfig.getTroopsLimit() || soldier > userCityInfo.getCurSoldier()) {
            return ErrorWord.ITEM_LACK;
        }
        if (partnerIds.size() > WorldConstant.WORLD_TEAM_PARTNER_MAX || partnerIds.size() < 1) {
            return ErrorWord.ALREADY_MAX;
        }

        UserPower userPower = GameUser.getUserPower(userId);
        List<UserWorldPartner> partnerList = new ArrayList<>();
        List<UserPartner> userPartnerList = new ArrayList<>();
        JsonArray jsonArray = new JsonArray();
        int maxSoldier = 0;// 携带的兵力上限
        for (int i = 0; i< partnerIds.size(); i++) {
            int partnerId = partnerIds.get(i);
            UserPartner userPartner = PartnerManager.getUserPartner(userId, partnerId);
            if (userPartner == null) {
                return ErrorWord.WRONG_STATUS;
            }
            UserWorldPartner userWorldPartner = WorldManager.getUserWorldPartner(userId, partnerId);
            if (userWorldPartner.getTeamId() > 0) {
                return ErrorWord.REPEATED_OPERATION;
            }
            partnerList.add(userWorldPartner);
            userPartnerList.add(userPartner);
            jsonArray.add(partnerId);

            maxSoldier += userPartner.takeSoldierMax();
        }

        if (soldier > maxSoldier) {
            return ErrorWord.ALREADY_MAX;
        }

        long totalPower = 0L;// 总的战力
        for (UserPartner userPartner : userPartnerList) {
            int skillAdd = WorldManager.countWorldPowerAdd(userPartnerList, SkillConstant.EFFECT_TYPE_104, userPartner.getCharacterType());// 百分比
            skillAdd += WorldManager.countWorldPowerAdd(userPartnerList, SkillConstant.EFFECT_TYPE_29, userPartner.getCharacterType());// 百分比   出站的战力增加百分百
            int addCv = WorldManager.countWorldPowerAdd(userPartnerList, SkillConstant.EFFECT_TYPE_103, userPartner.getCharacterType());// 固定值
            long partnerPower = GameUser.countPowerByPartner(userId, userPartner.getPartnerId(), userPartner, userPower,  skillAdd) + addCv;// 某个干员的当前总战力, 基础战力 + 基础战力 * 加成（通用加成+模块加成） + 加的固定值
            totalPower += partnerPower;
        }

        // 执行逻辑
        Common.PBUserData.Builder pbUserData = response.getUserBuilder();

        userWorldInfo.subEnergy(userInfo, bossConfig.getEventEnergy(), LogType.WORLD_TEAM_GO);
        userWorldInfo.update();
        ProtoDataUtils.updatePBUserData(pbUserData, userWorldInfo);// 扣除体力

        userCityInfo.addSoldierBattle(soldier);// 增加战斗中的士兵，减少兵力
        userCityInfo.update();
        ProtoDataUtils.updatePBUserData(pbUserData, userCityInfo);// 兵力信息

        WorldManager.createLoactionTeamInfo(pbUserData, userId, userWorldEventLocation, userWorldTeam);//  创建事件坑位的队伍派遣信息

        userWorldTeam.putStatus(WorldConstant.WORLD_TEAM_STATUS_1);
        userWorldTeam.putLocationId(locationId);
        userWorldTeam.putStartTime(curTime);
        userWorldTeam.putPartner(jsonArray.toString());
        userWorldTeam.putSoldier(soldier);
        userWorldTeam.putPower(totalPower);
        userWorldTeam.putTimeLeft(userWorldEventLocation.getOnewayTime());
        userWorldTeam.putUpdateTime(curTime);
        userWorldTeam.putEventId(userWorldEventLocation.getEventId());
        userWorldTeam.putForces(totalPower);  // 战力和队伍实力其实一样
        userWorldTeam.putOnewayTime(WorldManager.countWayTime(userPartnerList, userWorldEventLocation.getOnewayTime()));
        userWorldTeam.putCoordX(coordX);
        userWorldTeam.putCoordY(coordY);
        userWorldTeam.putUniqeId(Tool.getUUID());
        userWorldTeam.putTotalForces(userWorldEventLocation.getTotalForces());
        List<RewardItem> groupReward = WorldBossManager.getWorldBossGroupReward(bossConfig.getBossReward(), totalPower,userPower.getEarn());
        userWorldTeam.putRandomReward(CommonUtils.getRewardString(groupReward));   // 塞奖励
        userWorldTeam.update();
        ProtoDataUtils.updatePBUserData(pbUserData, userWorldTeam);// 队伍信息
        MainTaskManager.addTaskProgress(pbUserData, userInfo, MainTaskConstant.TASK_TYPE_254, 1);// 累计参与{0}次世界BOSS
        MainTaskManager.addTaskProgress(pbUserData, userInfo, MainTaskConstant.TASK_TYPE_70, 1);// 参与{0}次世界BOSS
        for (UserWorldPartner userWorldPartner : partnerList) {
            userWorldPartner.putTeamId(teamId);
            userWorldPartner.update();
            ProtoDataUtils.updatePBUserData(pbUserData, userWorldPartner, true);// 干员信息
        }
        // 设置定时器
        sendWorldBossTimer(userId,  userWorldTeam);
        // 1. 先取消原有的定时任务
        int fightResult = userWorldTeam.countFightResult();
        response.setResult(fightResult);
        return null;
    }

    // 发送定时任务
    public static void sendWorldBossTimer(long userId, UserWorldTeam userWorldTeam) {
        // 起一个定时器去处理  添加参数
        JsonObject jsonObject = new JsonObject();
        jsonObject.put("user_id", userId);
        jsonObject.put("team_id", userWorldTeam.getTeamId());
        jsonObject.put("unique_id", userWorldTeam.getUniqeId());
        //  获取实际到达的时间
        long arriveTime = userWorldTeam.takeArriveTime();
        // 判断时间是否在准备期，如果到达时间小于，那么定时器的执行是在进行期设置
        if (arriveTime < WorldBossManager.getBattleTime()){
            arriveTime = WorldBossManager.getBattleTime();
        }
        jsonObject.put("end_time",arriveTime);
        TimedTaskManager.sendMainTaskRetry(TimeTaskCmd.MAIN_WORLD_BOSS, jsonObject);// 发送失败,需要进行重发
    }



    // 容错，定时服如果挂了尝试自动到达
    public static void tryAutoArrive(int serverId,long userId) {
        if (!isOpen(serverId)) return;
        if (!canGoToWorldBoss(serverId)) return; // 这期间无法执行世界Boss事件
        List<UserWorldTeam> userWorldTeams = WorldManager.getUserWorldTeamList(userId);
        long curTime = TimeUtils.getStartTimeOfDay(userId);
        for (UserWorldTeam userWorldTeam : userWorldTeams) {
            if (userWorldTeam.getStatus() != WorldConstant.WORLD_TEAM_STATUS_1) continue;  // 如果不是过去的就跳过
            if (userWorldTeam.getLocationId() != WorldConstant.WORLD_EVENT_LOCATION_ID_BOSS) continue; // 如果不是世界boss事件跳过
            // 判断时间是否隔了5秒
            if (curTime < userWorldTeam.takeArriveTime() + TRY_AUTO_BATTLE) continue;
            autoArrive(userId,userWorldTeam.getTeamId(),userWorldTeam.getUniqeId());
        }
    }

    /**
     * 自动到达并且战斗
     *
     * @param userId
     * @param teamId
     */
    public static void autoArrive(long userId, int teamId,String uniqueId) {
        // 判断时间是否过期，过期不完成事件
        Lock lock = null;
        try {
            lock = MainService.getVertLock(LockKey.getWorldTeam(userId));
            UserWorldTeam userWorldTeam = WorldManager.getUserWorldTeam(userId, teamId);
            if (userWorldTeam.getStatus()!=WorldConstant.WORLD_TEAM_STATUS_1) return; // 不是在行军途中 直接放弃
            if(!userWorldTeam.getUniqeId().equals(uniqueId)){
                return;   // 两次唯一值不一样说明有行军有加速过不执行
            }
            UserInfo userInfo = GameUser.getUserInfo(userId);
            WorldBossManager.updateWorldBossRank(userInfo, userWorldTeam.getPower());  // 更新世界Boss伤害排行
            //  过不过期都要回去
            //  按照顺序去执行对应的战斗
            int newOneWayTime = WorldManager.takeReturnTime(userWorldTeam.getOnewayTime());//返程的时间 过去途中耗时的50%，300表示返程时间上限300秒
            userWorldTeam.putResult(userWorldTeam.countFightResult()); // 作战成功
            userWorldTeam.putStatus(WorldConstant.WORLD_TEAM_STATUS_2);// 改成返回状态
            userWorldTeam.putTimeLeft(newOneWayTime);
            userWorldTeam.putOnewayTime(newOneWayTime);
            userWorldTeam.putUpdateTime(TimeUtils.getCurTime());
            userWorldTeam.putHelpDbid(0L);// 返程也可以发起求助
            userWorldTeam.updateQueueNow();
            CsGameSystem.CSGameSystemPushDataResponse.Builder response = CsGameSystem.CSGameSystemPushDataResponse.newBuilder();
            Common.PBUserData.Builder PbUserData = response.getUserBuilder();
//            UserWorldEventLocation userWorldEventLocation = WorldManager.getUserWorldEventLocation(userId,  WorldConstant.WORLD_EVENT_LOCATION_ID_BOSS);
//            ProtoDataUtils.updatePBUserData(PbUserData, userWorldEventLocation);
            UserWorldEventLocationTeam userWorldEventLocationTeam = WorldManager.getUserWorldEventLocationTeam(userId, WorldConstant.WORLD_EVENT_LOCATION_ID_BOSS, userWorldTeam.getTeamId());
            if (userWorldEventLocationTeam != null){
                userWorldEventLocationTeam.delete();
                ProtoDataUtils.deletePBUserData(PbUserData, userWorldEventLocationTeam);
            }
            ProtoDataUtils.updatePBUserData(PbUserData, userWorldTeam);
            //  推送方法
            GameUser.pushPBUserData(userId,response);
        } catch (Exception e) {
            logger.info("世界boss自动战斗,userId:{},teamId:{},error:{}", userId, teamId, e.getMessage());
        } finally {// 释放锁
            MainService.releaseVertLock(lock);
        }
    }


    /**
     * 结算排行榜奖励
     */
    public static void sendWorldBossRankReward() {
        // 发放单服排名奖励
        try {
            ConcurrentHashMap<Integer, ServerInfo> serverList = ServerManager.getServerList();
            int rankType = RankConstant.SERVER_RANK_WORLD_BOSS;
            int rankType2 = RankConstant.SERVER_UNION_RANK_WORLD_BOSS;
            String dateKey = RankManager.getDateKey(RankConstant.SERVER_RANK_WORLD_BOSS);//今日的0点0分0秒
            String dateKey2 = RankManager.getDateKey(RankConstant.SERVER_UNION_RANK_WORLD_BOSS);//今日的0点0分0秒
            for (ServerInfo server : serverList.values()) {
                MainVerticle.logger.info("开始发放世界boss排行和成就奖励!,serverId:{}",server.getServerId());
                WorldBoss worldBossConfig = getWorldBossConfig(server.getServerId());
                if (worldBossConfig == null) {
                    MainVerticle.logger.info("还没有解锁世界Boss的配置!");
                    continue;
                }
                int rankMaxNum = RankManager.getRankTypeMaxNum(rankType);
                JsonArray serverRankList = RankManager.getRankIdListByIndex(rankType, server.getServerId(), dateKey, 0, rankMaxNum - 1);
                MainVerticle.logger.info("## send  worldBossRankReward reward serverId = " + server.getServerId() + " rank size = " + serverRankList.size());
                for (int i = 0; i < serverRankList.size(); i++) {
                    int rank = i + 1;
                    long userId = Long.parseLong(serverRankList.getString(i));
                    // 获取玩家世界boss信息
                    UserWorldBossInfo userWorldBossInfo = getUserWorldBossInfo(userId);
                    RankReward rankReward = RankManager.getRankReward(rankType, rank, 0);
                    if (rankReward != null) {
                        MainVerticle.logger.info("## send  worldBossRankReward reward rankType " + rankType + " rank = " + rank + " userId = " + userId);
                        String rankStr = rank + "";
                        MailManager.sendSystemMailReplaceContent(userId, MailConstant.RANK_WORLD_BOSS_TITLE, MailConstant.RANK_WORLD_BOSS_CONTENT, CommonUtils.takeReawrdItemFromStr(rankReward.getReward()), LogType.WORLD_BOSS_RANK_REWARD, rankStr);
                    }
                    // 如果有退出的玩家就不发放 || 没有联盟不发放
                    boolean isContinue = userWorldBossInfo.getIsQuit() != 0 || userWorldBossInfo.getUnionId() == 0;
                    if (!isContinue) {
                        // 处理玩家的联盟成就奖励补发
                        long myScore = RankManager.getMyScore(rankType2, server.getServerId(), userWorldBossInfo.getUnionId(), dateKey2);
                        // 根据伤害去算获取哪几档的奖励
                        List<RewardItem> rewardItems = WorldBossManager.getWorldBossTaskReward(worldBossConfig.getBossTask(), myScore);
                        if (!rewardItems.isEmpty()) {
                            MainVerticle.logger.info("## send  worldBossUnionTaskReward reward rankType " + rankType2 + " myScore = " + myScore + " userId = " + userId);
                            String rankStr = myScore + "";
                            MailManager.sendSystemMailReplaceContent(userId, MailConstant.RANK_WORLD_BOSS_UNION_TITLE, MailConstant.RANK_WORLD_BOSS_UNION_CONTENT, rewardItems, LogType.WORLD_BOSS_UNION_TASK_REWARD, rankStr);
                        }
                    }
                }
                // 设置榜单过期
                if (!serverRankList.isEmpty()) {
                    String rankKey = RankManager.getRankName(rankType, server.getServerId(), dateKey);
                    RedisTools.expire(rankKey, 2 * TimeUtils.WEEK);
                    String rankKey2 = RankManager.getRankName(rankType2, server.getServerId(), dateKey2);
                    RedisTools.expire(rankKey2, 2 * TimeUtils.WEEK);
                }

            }
        } catch (NumberFormatException e) {
            logger.info("###sendWorldBossRankReward error:{}", e.getMessage());
        }
    }


    // 判断是否解锁
    public static boolean isOpen(int serverId) {
        int unlockDay = AllParam.WORLD_BOSS_OPEN_DAY;
        // 获取开服时间和配置的时间差的几天
        int serverOpenDay = ServerManager.getServerOpenDay(serverId);
        return serverOpenDay >= unlockDay;
    }

    // 判断能否行军
    public static boolean canGoToWorldBoss(long curTime) {
        int prepareMinute = AllParam.WORLD_BOSS_PREPARE_TIME;  // 提前多少分钟

        long openTime = TimeUtils.getTodayOneTime(AllParam.WORLD_BOSS_TIME_START); // 开始时间
        long endTime = TimeUtils.getTodayOneTime(AllParam.WORLD_BOSS_TIME_END); // 开始时间
        long startTime = (long) openTime - (long) prepareMinute * TimeUtils.MINUTE;
        return curTime >= startTime && curTime < endTime;
    }

    // 是否进行期
    public static boolean isBattleStep(long curTime) {
        long startTime = TimeUtils.getTodayOneTime(AllParam.WORLD_BOSS_TIME_START); // 开始时间
        long endTime = TimeUtils.getTodayOneTime(AllParam.WORLD_BOSS_TIME_END); // 开始时间
        return curTime >= startTime && curTime < endTime;
    }

    // 是否进行期
    public static boolean isPrepareStep(long curTime) {
        int prepareMinute = AllParam.WORLD_BOSS_PREPARE_TIME;  // 提前多少分钟
        long endTime = TimeUtils.getTodayOneTime(AllParam.WORLD_BOSS_TIME_START); // 开始时间
        long startTime = (long) endTime - (long) prepareMinute * TimeUtils.MINUTE;
        return curTime >= startTime && curTime < endTime;
    }

    // 战斗开始时间
    public static long getBattleTime(){
        return TimeUtils.getTodayOneTime(AllParam.WORLD_BOSS_TIME_START); // 开始时间
    }

}
